<template>
	<view class="content">
	<view class="poFi top-0 left-0 bgfff display-sa align-items fontSize-28 col-6 width-100 top_view">
		<text v-for="item in nav_list" :key="item.id" :class="current==item.id?'col-C9951C active':''" class="text_nav" @click="change(item.id)">{{item.text}}</text>
	</view>
	<view class=" ev_list pad-lr-30 over-hid" v-show="current==0">
		<view class="mar-top-30 radius-16 bgfff display align-items" v-for="item in List" :key="item.id">
			<image :src="item.goods_image" class="proudct-item-icon-10 radius-16" mode=""></image>
			<view class="ml20 right_widthx">
				<view class="text-clamp-1 fontSize-28">{{item.name}}</view>
				<view class="display align-items mar-top-20 fontSize-26">
					<text>{{item.sku_name}}</text>
				</view>
				<view class="mar-top-10 display-sb align-items">
					<view class=" fontSize-28 col-E23737">￥{{item.price}}</view>
					<view class="pad-lr-32 pad-tb-12 fontSize-26 radius-30 col-f bg2DB295 ml20" @click="gowriteevaluate(item.order_goods_id,item.order_id)">去评价</view>
				</view>
			</view>
		</view>
		<view class="display-ce align-items" v-if="List?.length==0">
			<tm-result :showBtn="false" subTitle=" " title="暂无数据" color="#bc8c1e"></tm-result>
		</view>
	</view>
	<view class="pad-lr-20" v-show="current==1">
		<view class="pad-lr-20 pad-tb-20 bgfff radius-16 mar-top-20" v-for="item in List" :key="item.id">
			<view class="display-sb align-items">
				<view class="display align-items fontSize-26">
					<text>{{item.evaluate_time}}</text>
				</view>
				<uni-rate :size="20" activeColor="#F6911B" allowHalf v-model="item.score" readonly />
			</view>
			<view class="pad-tb-20 borderbottom fontSize-26">
				{{item.content}}
			</view>
			<view class="display align-items flex-wrap">
				<image :src="it" class="wid-hig-180 radius-16 textimg mar-top-24" mode="aspectFill"
					v-for="it in item.evaluate_images" :key="item" @click="seeimg(item.evaluate_images,it)"></image>
			</view>
			<view class="mar-top-20 radius-16 bgfff display align-items">
				<image :src="item?.goods_image" class="proudct-item-icon-6 radius-16" mode=""></image>
				<view class="ml20 right_width">
					<view class="display-sb align-items">
						<view class="text-clamp-1 fontSize-28">{{item?.name}}</view>
						<view class=" fontSize-28 col-E23737">￥{{item?.price}}</view>
					</view>
					<view class="display align-items mar-top-42 fontSize-26">
						<text>{{item?.sku_name}}</text><text class="ml16">x{{item?.num}}</text>
					</view>
				</view>
			</view>
			<view class="mar-top-20 radius-16 pad-lr-20 pad-tb-20 bgf6" v-if="item.reply_content">
				<view class="fontSize-28">平台回复：</view>
				<view class="mar-top-20 fontSize-26">{{item.reply_content}}</view>
				<view class="text-align-right fontSize-26 col-9 mar-top-20">
					{{item.reply_time}}
				</view>
			</view>
		</view>
		<view class="display-ce align-items" v-if="List?.length==0">
			<tm-result :showBtn="false" subTitle=" " title="暂无数据" color="#bc8c1e"></tm-result>
		</view>
	</view>
	</view>
</template>

<script lang="ts" setup>
import { onLoad, onShow } from '@dcloudio/uni-app';
import { ref } from 'vue';
import {myEvaluateList} from '@/utils/api'
onLoad(()=>{
	_my_evaluate()
	
})
onShow(()=>{
	uni.$on('updatapingjia',()=>{
		_my_evaluate()
	})
})
const current = ref(0)
const nav_list = ref([{id:0,text:'待评价(10)'},{id:1,text:'已评价'}])
const change=(id:number)=>{
	page.value = 1
	List.value = []
	current.value = id
	_my_evaluate()
}
//待评价列表
const List = ref([])
const page = ref(1)
const _my_evaluate =() =>{
	myEvaluateList({status:current.value,page:page.value,limit:10}).then(res=>{
		if(res.code==1){
			if(current.value==0){
				nav_list.value[0].text = '待评价('+res.data.order_goods.data.length+')'
			}
			List.value = List.value.concat(res.data.order_goods.data)
			if(res.data.order_goods.data.length>0){
				page.value++
			}
		}
	})
}
const gowriteevaluate =(id:number,order_id:number) =>{
	uni.navigateTo({
		url:'/mypages/writeevaluate/writeevaluate?order_goods_id='+id+'&order_id='+order_id
	})
}
const seeimg = (e,info : string) => {
		uni.previewImage({
			urls: e,
			current: info
		})
	}
</script>

<style lang="scss">
@import 'evaluatelist.scss';
</style>
